-
Notifications
You must be signed in to change notification settings - Fork 196
Internationalize homepage, header and footer #1013
Conversation
…evant changes to test
@ayanchoudhary what are the reasons for and against internationalizing them? |
@ayanchoudhary I would also like to hear your thoughts on the pros and cons of internationalizing them. |
@akmadian this branch is already pointing to |
@ayanchoudhary as discussed on Slack, please go ahead and internationalize those strings. |
@ayanchoudhary Please tag me here on github when you are ready for final review :) |
So I was going through the process of internationalizing the license strings(which are coming from the vuex store), turns out vue-i18n does not provide any inbuilt support for internationalizing vuex-store out of the box. I found (this package built on vue-i18n)[https://github.com/dkfbasel/vuex-i18n] but it hasn't been updated since a year. So should I go ahead with it? @akmadian @kgodey |
Hi @ayanchoudhary, I am going to look into this even deeper for you, but I may have found a possible solution. The vue-i18n plugin has a This is the basic idea: <template>
<p>{{ $t("hello") }}</p>
</template>
<script>
export default {
name: "any-component",
mounted() {
this.$i18n.mergeLocaleMessage("en", {hello: this.$state.store.hello });
}
};
</script> I made a small demo here you can check out: I made you a quick demo here: https://codesandbox.io/s/mergelocalemessage-proof-of-concept-rx1j5 Let me know what you think! I believe this solves the issue of storing translation strings inside of vuex, but there may be some details specific to the cc search project that I am missing. |
Hi @zackkrida thanks for the demo, but the problem which we have here is actually the exact opposite of that from the sandbox, like here we have the translation strings in the normal messages format and the en strings in the store, but I guess we can reverse it to fix that out, let me try it out on the code. Will keep you updated 😃. |
@ayanchoudhary ideally, the translations should be in the locale messages JSON file. If they keys are well defined, a function can map the code in the store to the key path of the locale message, something like:
I think trying to "localize the store" is unnecessary complexity and you remove the hardcoded |
@brenoferreira thank you so much; I understand the issue now! @ayanchoudhary the basic idea is that you remove the // would actually just be in the locale json files, but you get the idea
const messages = {
en: {
filters: {
licenseType: {
commercial: 'Use commercially',
modification: "Modify or adapt"
}
}
}
}; thanks again @brenoferreira |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that the license types were included as part of your other PR, this looks complete! Thank you.
Fixes
Fixes #942 by @brenoferreira
Description
Internationalizes the CC search homepage
Screenshots
Checklist
Update index.md
).master
branch of the repository.visible errors.
Developer Certificate of Origin
Developer Certificate of Origin